home *** CD-ROM | disk | FTP | other *** search
/ Building Homes of Our Own / Building Homes of our Own.iso / setup / data1.cab / Everything / working / houCons.dxr / interface_998_LSTileBehave.ls < prev    next >
Encoding:
Text File  |  2002-09-25  |  1.7 KB  |  74 lines

  1. property mySprite, Active, actionNum, myType, tileIconName, LSDisplaySprite, ancestor, initted, state
  2.  
  3. on beginSprite me
  4.   mySprite = me.spriteNum
  5.   myType = #tileSprite
  6.   state = #off
  7.   Active = 0
  8.   ancestor = new(script("LS_TileBehave actions"), mySprite)
  9. end
  10.  
  11. on exitFrame me
  12.   global gIsoEngineTracker, gIso, gUserDataMan
  13.   if not initted then
  14.     init(me)
  15.     initted = 1
  16.   end if
  17.   if tileShouldGoInactive(me) then
  18.     goInactive(me)
  19.   else
  20.     goActive(me)
  21.   end if
  22.   if not Active then
  23.     exit
  24.   end if
  25.   set the loc of sprite mySprite to the mouseLoc
  26. end
  27.  
  28. on mouseUp me
  29.   global gIso, gUserDataMan, gPromptMan
  30.   clickLoc = the mouseLoc
  31.   if not Active then
  32.     exit
  33.   end if
  34.   if voidp(LSDisplaySprite) then
  35.     LSDisplaySprite = sendAllSprites(#sendSpriteNum, #LandscapingDisplay)
  36.   end if
  37.   curItem = sendSprite(LSDisplaySprite, #getCurItem)
  38.   curCost = sendSprite(LSDisplaySprite, #getCurCost)
  39.   curItem = string(curItem)
  40.   curItem = replaceChar(curItem, "_", " ")
  41.   curItemName = word 1 of curItem
  42.   curItemNum = integer(word 2 of curItem)
  43.   result = plantFoliage(gIso, the clickLoc, curItemNum)
  44.   if result = curItemNum then
  45.     itemSymbol = "landscaping_" & curItemName
  46.     itemSymbol = symbol(itemSymbol)
  47.     purchaseLandscaping(gUserDataMan, itemSymbol, curCost)
  48.   else
  49.     doPrompt(gPromptMan, #LSConflict)
  50.   end if
  51. end
  52.  
  53. on killTile me
  54.   global gIsoEngineTracker
  55.   setTileFloating(gIsoEngineTracker, 0)
  56.   goInactive(me)
  57.   actionNum = VOID
  58.   myTile = VOID
  59.   tileFloating = 0
  60. end
  61.  
  62. on showProps me
  63.   PropNum = count(me)
  64.   repeat with x = 1 to PropNum
  65.     prop = 0
  66.     thisProp = getPropAt(me, x)
  67.     if thisProp = #myHandlers then
  68.       next repeat
  69.     end if
  70.     prop = string(getPropAt(me, x)) && "=" && getaProp(me, thisProp)
  71.     put prop
  72.   end repeat
  73. end
  74.